package util;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;


public class PolicyFile {

    public static final String POLICY_FILE_CONTENT = "grant{permission java.security.AllPermission;};";

    public static String getLocationOfPolicyFile() {
        try {
            File tempFile = File.createTempFile("rmi-base", ".policy");
            BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile));
            writer.append(POLICY_FILE_CONTENT);
            
            writer.close();
            tempFile.deleteOnExit();
            return tempFile.getAbsolutePath();
        }
        catch(IOException e) {
            throw new RuntimeException(e);
        }
    }
} 